Micron Document




Comment (computer programming)
part 21/37 · 66.0 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
A relatively loose collection of languages use -- for a single line comment. Notable languages include: Ada, Eiffel, Haskell, Lua, SQL and VHDL. Block comment support varies. An example in Ada:

-- the air traffic controller task takes requests for takeoff and landing
task type Controller (My_Runway: Runway_Access) is
-- task entries for synchronous message passing
entry Request_Takeoff (ID: in Airplane_ID; Takeoff: out Runway_Access);
entry Request_Approach(ID: in Airplane_ID; Approach: out Runway_Access);
end Controller;

Block in Haskell

In Haskell, a block comment is delimited by {- and -}. For example:

{- this is a comment
on more lines -}
-- and this is a comment on one line
putStrLn "Wikipedia" -- this is another comment

Haskell also provides a literate programming method of commenting known as "Bird Style".cite-ref-45[45] Lines starting with > are interpreted as code and everything else is considered a comment. One additional requirement is a blank line before and after the code block:

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────